All Questions
Tagged with react-contextreact-hooks
1,245 questions
0votes
1answer
61views
React get data from children context inside the parent component
I'm trying to set up a form with many rows of data, with each individual items. When I click a button, I want to get all of the data from each children, and submit the form. I'm using context to ...
1vote
1answer
34views
Why attendence Context fetching again on navigation back to the teacherattend component?
I need to use attendance data often on my website, So I make it as utility as below: import React, { useState, useEffect, useMemo, useCallback, createContext } from 'react'; import { ...
2votes
2answers
65views
Context Provider not passing value to children
I am trying to create a parent/overarching context. The purpose of the context is to store UserInfo which should then be available to all children. UserInfo is set by getting config from an API. ...
0votes
1answer
43views
controlling React Context - caused rendering
I am using a react App, with a context holdling a wordlist. I have a child component of the context , which uses a context function which edits the current word (setting the wordlist). When I do that ...
0votes
1answer
59views
How to utilise useContext within a seperate function - ReactJS
I'm attempting to seperate my usage of useContext and the ensuing array manipulation into a callable function (ChangeContent) so that I can utilise it across other functions/components, instead of ...
1vote
1answer
83views
Context state not setting properly in React
The title may be ambiguous but I am having a issue that redirects me to /home after I render the component assigned to /logout, whose job is to clear the storage and reset the AuthContext states. I ...
1vote
1answer
129views
send form with button from another component using usecontext in react js
I'm trying to send this form inputs from component A using a button in component B. Both of them are stored in context provider I've created: context.jsx: export const SubmitContext = createContext(...
-1votes
1answer
46views
React calling API requests before axios sets auth headers
I am trying to set up AuthContext is react and running into a problem where react calls an API before axios sets the auth headers in the request. This is causes API failures on first render missing ...
1vote
1answer
46views
this react context "DELETE_BLOG' is not Working properly is there any problem in the code?
import { Link, useNavigate } from "react-router-dom"; import { useBlogContext } from '../Hooks/useBlogContext'; const Blogs = ({ blog }) => { const navigate = useNavigate(); ...
1vote
3answers
79views
How do I create a custom hook like useState for context value to get previous state value?
I have a context like this ProductProvider.js import React, { createContext, useMemo } from 'react' const INITIAL_HANDLER = { sortType: null, offset: 0 } export const ProductProviderContext = ...
2votes
1answer
44views
React use hooks (useContext) inside of useReducer
I have a reducer inside useContext/provider. I need to validate an action using values from another Provider. Is there a way to retrieve those values from a Provider from within the useReducer hook? ...
-1votes
1answer
721views
Passing callback function to useContext in React
I've created simple context and custom hook to use it and i want to pass callback function through this hook. Is it even possible? Bear in mind its not the actual code, it's just supersimple ...
2votes
2answers
52views
Error React Js Firebase show createUser is not a function (using Context)
I am very new to React JS and Firebase. I tried to https://medium.com/ topic "Building a Firebase Authentication and Private Route System in a React App" After modifying the code and trial ...
-1votes
1answer
101views
Converting Zustand code to Context API state [closed]
I have this piece of code written in typescript for zustand state management library export const useStore = <T, F>( store: (callback: (state: T) => unknown) => unknown, callback: (...
-1votes
1answer
165views
React useContext not updating value in same component [duplicate]
I am having a sample react app with 2 components Component1 & Component2 as below. i am using useContext hook to update the context value in Component2 and reading the updated context value in ...